package daos;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.Query;

import model.entities.AbstractEntity;

public class AbstractDAO<E extends AbstractEntity> {
	EntityManager manager;

	public AbstractDAO(EntityManager manager) {
		this.manager = manager;
	}

	public void salvar(E entity) {
		manager.persist(entity);
	}

	public Class<E> entityClass() {
		return null;
	}

	public void remover(E entity) {
		manager.remove(entity);
	}


	public E buscarPorId(Long id) {
		return manager.getReference(entityClass(), id);
		
	}
	
}
